$.ajaxPrefilter(options => {
	// 1.统一配置根地址
	options.url = `http://124.223.14.236:8060/admin${options.url.includes('/upload?type=images') ? '/common' : ''}` + options.url
	// 2. 统一配置携带token
	if (options.url.includes('/index/login') || options.url.includes('/index/getConfig')) return
	const token = localStorage.getItem('token')
	token ? options.headers = {
		'x-token': token
	} : location.href = '/youdianda_static/login.html'

	// 3. 统一处理错误
	options.complete = ({ responseJSON: { errmsg, errno } }) => {
		if (errmsg === '登陆验证失败，请重新登陆！' && errno === 9997) location.href = '/youdianda_static/login.html'
	}
})
